package wang.yangziqing.app_kotlin.utils

import wang.yangziqing.app_kotlin.R
import wang.yangziqing.app_kotlin.base.BaseFragment
import wang.yangziqing.app_kotlin.ui.fragment.HomeFragment
import wang.yangziqing.app_kotlin.ui.fragment.MVFragment
import wang.yangziqing.app_kotlin.ui.fragment.VBangFragment
import wang.yangziqing.app_kotlin.ui.fragment.YueDanFragment

/**
 * Created by Administrator on 2017/11/29.
 *
 */
//私有化静态方法
class FragmentUtils private constructor() {
    val HomeFragment by lazy { HomeFragment() }
    val MVFragment by lazy { MVFragment() }
    val VBangFragment by lazy { VBangFragment() }
    val YueDanFragment by lazy { YueDanFragment() }

    companion object {
        val fragmentUtils by lazy { FragmentUtils() }
    }

    //根据tabid获取对应的fragment
    fun getFragment(tabId: Int): BaseFragment? {
        when (tabId) {
            R.id.tab_home -> return HomeFragment
            R.id.tab_vbang -> return VBangFragment
            R.id.tab_yuedan -> return YueDanFragment
            R.id.tab_mv -> return MVFragment

        }

        return null
    }


}